#include "application/Application.h"
#include "config/ConfigManager.h"
#include "log/Logger.h"
#include "device/device.h"
CApplication::CApplication()
{
}
CApplication::~CApplication()
{
}
//初始化，启动读取全局配置
bool CApplication::init()
{
    //日志模块初始初始化
    CLogger * pLogInstance = CLogger::instance();
    if(nullptr == pLogInstance)
    {
        LOG_INFO("Log init false");
        return false;
    }
    //配置初始配置
    
    CConfigManager *pInstance = CConfigManager::instance();
    if (nullptr !=pInstance)
    {
        std::string strPath = "/mnt/hgfs/workspace/OpenSource/ServerRouter/bin/CFG";
        Json::Value temValue;
        if(pInstance ->loadConfig(strPath, temValue))
        {
            LOG_ERROR("LoadConfg error");
            return false;
        }
        LOG_INFO("Load Config:" << temValue.toStyledString());
        return true;
    }
   
    //获取设备状态信息
    CDevieStatus *pDevice = CDevieStatus::GetInstance();
    if(nullptr != pDevice)
    {
        pDevice->init();  
    }
}

